package com.pingan.agentbank.aaos.testme;

import com.pingan.agentbank.aaos.pojo.ApproLineInfo;
import com.pingan.agentbank.aaos.util.FixedLenUtil;
import com.pingan.vframe.sdo.ServiceData;
import com.pingan.vframe.util.JaDateTime;
import com.pingan.vframe.util.StringUtil;
import org.junit.Test;

public class ZJKBFieldTest {
    public  ApproLineInfo approLineInfo = new ApproLineInfo();
    public  ServiceData serviceData = new ServiceData();

    public void method0(){

        serviceData.putString("EMP_DEPARTMENT",serviceData.getString("departname"));
        serviceData.putString("HOME_STATE",serviceData.getString("home_state"));
        serviceData.putString("HOME_CITY",serviceData.getString("home_city"));
        serviceData.putString("HOME_ZONE",serviceData.getString("home_zone"));
        serviceData.putString("HOME_ADD",serviceData.getString("home_add"));
        serviceData.putString("EMP_PROVINCE",serviceData.getString("emp_province"));
        serviceData.putString("EMP_CITY",serviceData.getString("emp_city"));
        serviceData.putString("EMP_ZONE",serviceData.getString("emp_zone"));
        serviceData.putString("EMP_ADD",serviceData.getString("emp_add"));
        serviceData.putString("OWNING_BRANCH",serviceData.getString("expand_branch"));

        serviceData.putString("ORG","000064901380");
        serviceData.putString("APP_TYPE","B");
        serviceData.putString("APP_LMT","");

        String product_id = "";
        if ("C".equals(approLineInfo.getCreditcardtype())&&"G".equals(approLineInfo.getCreditcardcategory())&&"0000".equals(approLineInfo.getAffinitycode())){
            product_id = "000041";
        } else if ("C".equals(approLineInfo.getCreditcardtype())&&"C".equals(approLineInfo.getCreditcardcategory())&&"0000".equals(approLineInfo.getAffinitycode())){
            product_id = "000040";
        }
        serviceData.putString("PRODUCT_CD",product_id);
        serviceData.putString("CLIENT_TYPE","A00");


        serviceData.putString("APP_SOURCE","50");
        serviceData.putString("APPNO_EXTERNAL",approLineInfo.getApplication_no());
        serviceData.putString("APP_CODE","");
        serviceData.putString("REALTIME_ISSUING_FLAG","N");


        serviceData.putString("CARD_FACE","");
        serviceData.putString("IF_SELECTED_CARD","");
        serviceData.putString("CARD_NO","");
        serviceData.putString("NAME",approLineInfo.getChinese_name());
        serviceData.putString("NAME_LOGO",approLineInfo.getOwner_name());
        serviceData.putString("GENDER",approLineInfo.getSex());

        String birthday = approLineInfo.getBirth_date().substring(0,4);
        JaDateTime jaDateTime = JaDateTime.valueOf(System.currentTimeMillis());
        String AGE = "";
        if (birthday!=null && !"".equals(birthday)){
            AGE =  String.valueOf(jaDateTime.getYear() - Integer.parseInt(birthday));
        }
        serviceData.putString("AGE",AGE);

        serviceData.putString("NATIONALITY","156");
        serviceData.putString("PR_OF_COUNTRY","");
        serviceData.putString("RESIDENCY_COUNTRY_CD","");


        //21 ID_TYPE
        String id_type = "";
        if (approLineInfo.getGlobal_type().equals("1")){
            id_type = "I";
        }
        serviceData.putString("ID_TYPE",id_type);
        serviceData.putString("ID_NO",approLineInfo.getGlobal_id());
        serviceData.putString("ID_LAST_DATE",approLineInfo.getGlobal_eff_enddate());
        String if_server_ever = "2099".equals(approLineInfo.getGlobal_eff_enddate().substring(0,4))?"Y":"N";
        serviceData.putString("IF_SERVE_EVER",if_server_ever);
        serviceData.putString("ID_ISSUER_ADDRESS","");
        serviceData.putString("BIRTHDAY",approLineInfo.getBirth_date());
        serviceData.putString("LIQUID_ASSET","");
        serviceData.putString("YEAR_INCOME","3000000");
        String education = approLineInfo.getEducation();
        String qualification = null;
        if ("02".equals(education)){
            qualification = "A";
        } else if ("03".equals(education)){
            qualification = "B";
        } else if ("04".equals(education)){
            qualification = "C";
        } else if ("05".equals(education)){
            qualification = "D";
        } else if ("07".equals(education)){
            qualification = "E";
        } else if ("08".equals(education)){
            qualification = "G";
        }
        serviceData.putString("QUALIFICATION",qualification);
        serviceData.putString("DEGREE","");


        String maritalStatus = approLineInfo.getMarital_status();
        if ("1".equals(maritalStatus)){
            maritalStatus = "S";
        } else if ("2".equals(maritalStatus)){
            maritalStatus = "M";
        } else if ("9".equals(maritalStatus)){
            maritalStatus = "O";
        }
        String houseOwnerShip = approLineInfo.getResidential_type();
        if ("1".equals(houseOwnerShip)){
            houseOwnerShip = "E";
        } else if ("2".equals(houseOwnerShip)){
            houseOwnerShip = "A";
        } else if ("3".equals(houseOwnerShip)){
            houseOwnerShip = "B";
        } else if ("4".equals(houseOwnerShip)){
            houseOwnerShip = "C";
        } else if ("5".equals(houseOwnerShip)){
            houseOwnerShip = "D";
        } else if ("9".equals(houseOwnerShip)){
            houseOwnerShip = "Z";
        }
        serviceData.putString("MARITAL_STATUS",maritalStatus);
        serviceData.putString("HOME_ADDR_CTRY_CD","156");
        serviceData.putString("HOUSE_OWNERSHIP",houseOwnerShip);
        serviceData.putString("HOME_POSTCODE",approLineInfo.getPostcode());
        serviceData.putString("HOME_PHONE","");
        serviceData.putString("HOME_STAND_FROM","");


        serviceData.putString("RESIDENCE_YEARS",approLineInfo.getReside_years());

        //42  ISSUING_CITY
        String issuing_city = "";
        if (approLineInfo.getGivecardcity().equals("0750")){
            issuing_city = "张家口市";
        } else if (approLineInfo.getGivecardcity().equals("0500")){
            issuing_city = "石家庄市";
        } else if (approLineInfo.getGivecardcity().equals("0630")){
            issuing_city = "唐山市";
        } else if (approLineInfo.getGivecardcity().equals("0650")){
            issuing_city = "廊坊市";
        } else if (approLineInfo.getGivecardcity().equals("0560")){
            issuing_city = "邯郸市";
        } else if (approLineInfo.getGivecardcity().equals("0610")){
            issuing_city = "沧州市";
        } else if (approLineInfo.getGivecardcity().equals("0670")){
            issuing_city = "承德市";
        } else if (approLineInfo.getGivecardcity().equals("0710")){
            issuing_city = "保定市";
        } else if (approLineInfo.getGivecardcity().equals("0540")){
            issuing_city = "邢台市";
        } else if (approLineInfo.getGivecardcity().equals("0660")){
            issuing_city = "秦皇岛市";
        } else if (approLineInfo.getGivecardcity().equals("0530")){
            issuing_city = "衡水市";
        }
        serviceData.putString("ISSUING_CITY",issuing_city);

        serviceData.putString("CELLPHONE",approLineInfo.getMobile());
        serviceData.putString("EMAIL",approLineInfo.getEmail());
        serviceData.putString("FAMILY_MEMBER","");
        serviceData.putString("FAMILY_AVGE_VENUE","");
        serviceData.putString("BANKMEM_FLAG","");
        serviceData.putString("BANKMEMBER_NO","");
        serviceData.putString("CORP_NAME",approLineInfo.getCompanyname());
        serviceData.putString("EMP_ADDR_CTRY_CD","156");

        serviceData.putString("EMP_POSTCODE",approLineInfo.getEmployer_postcode());


        //56 EMP_PHONE


        String five_six = "";
        if (null!=approLineInfo.getEmployer_phone()||!"".equals(approLineInfo.getEmployer_phone())){
            five_six = approLineInfo.getEmployer_phone();
        }
        serviceData.putString("EMP_PHONE",five_six);
        serviceData.putString("EMP_POST","D");
        serviceData.putString("EMP_STRUCTURE","Z");
        serviceData.putString("EMP_TYPE","Z");

        //60
        serviceData.putString("EMP_WORKYEARS",approLineInfo.getWorking_years());
        serviceData.putString("CORP_FAX","");
        serviceData.putString("OCCUPATION",approLineInfo.getJob_code());
        serviceData.putString("OCCUPATION_OTHER_DESC",approLineInfo.getJob_description());
        serviceData.putString("TITLE_OF_TECHNICAL","");
        serviceData.putString("EMP_POST_NAME",approLineInfo.getPositionname());
        serviceData.putString("POS_PIN_VERIFY_IND","Y");
        serviceData.putString("EMP_STABILITY","B");
        serviceData.putString("BANK_CUSTOMER_ID","");
        serviceData.putString("SM_AMT_VERIFY_IND","Y");
        //70
        serviceData.putString("F_CARD_NO","");
        serviceData.putString("F_RELATIONSHIP_TO_BSC","");
        serviceData.putString("F_NAME","");
        serviceData.putString("F_NAME_LOGO","");
        serviceData.putString("F_GENDER","");
        serviceData.putString("F_AGE","");
        serviceData.putString("F_BIRTHDAY","");
        serviceData.putString("F_MARITAL_STATUS","");
        serviceData.putString("F_PR_OF_COUNTRY","");
        serviceData.putString("F_RESIDENCY_COUNTRY_CD","");
        serviceData.putString("F_NATIONALITY","");
        serviceData.putString("F_QUALIFICATION","");
        serviceData.putString("F_DEGREE","");
        serviceData.putString("F_ID_TYPE","");
        serviceData.putString("F_ID_NO","");
        serviceData.putString("F_ID_LAST_ALL","");
        serviceData.putString("F_ID_LAST_DATE","");
        serviceData.putString("F_ID_ISSUER_ADDRESS","");
        serviceData.putString("F_YEAR_INCOME","");
        serviceData.putString("F_EMAIL","");
        serviceData.putString("F_HOUSE_OWNERSHIP","");
        serviceData.putString("F_HOME_STAND_FROM","");
        serviceData.putString("F_RESIDENCE_YEARS","");
        serviceData.putString("F_ISSUING_CITY","");
        serviceData.putString("F_CELLPHONE","");
        serviceData.putString("F_HOME_ADDR_CTRY_CD","");
        serviceData.putString("F_HOME_STATE","");
        serviceData.putString("F_HOME_CITY","");
        serviceData.putString("F_HOME_ZONE","");
        serviceData.putString("F_HOME_POSTCODE","");


        serviceData.putString("F_HOME_ADD","");
        serviceData.putString("F_HOME_PHONE","");
        serviceData.putString("F_POS_PIN_VERIFY_IND","");
        serviceData.putString("F_APPNO_ATTACH_EXTERNAL","");
        serviceData.putString("F_SM_AMT_VERIFY_IND","");
        serviceData.putString("F_CARD_FETCH","");
        serviceData.putString("F_FETCH_BRANCH","");
        serviceData.putString("F_CARD_MAILER_IND","");

        serviceData.putString("CARD_FETCH_METHOD","A");
        String cardMailerInd = approLineInfo.getSend_addr_type();
        if ("1".equals(cardMailerInd)){
            cardMailerInd = "H";
        } else if ("2".equals(cardMailerInd)){
            cardMailerInd = "C";
        }
        serviceData.putString("CARD_MAILER_IND",cardMailerInd);
        serviceData.putString("FETCH_BRANCH","");
        //112  STMT_MEDIA_TYPE
        serviceData.putString("STMT_MEDIA_TYPE","E");
        serviceData.putString("STMT_MAIL_ADDR_IND","");
        serviceData.putString("BILLING_CYCLE","");
        String dDinD = serviceData.getString("autoPayOff");
        if ("0".equals(dDinD)){
            dDinD = "F";
        } else if ("1".equals(dDinD)){
            dDinD = "N";
        }
        serviceData.putString("DD_IND",dDinD);
        if ("F".equals(dDinD)){
            serviceData.putString("DD_BANK_ACCT_NO_TYPE","N");
            serviceData.putString("DD_BANK_ACCT_NO",approLineInfo.getBank_account());
            serviceData.putString("DD_BANK_NAME","张家口银行股份有限公司");
            serviceData.putString("DD_BANK_ACCT_NAME",approLineInfo.getChinese_name());
            serviceData.putString("DD_BANK_BRANCH","0001");
        } else {
            serviceData.putString("DD_BANK_ACCT_NO_TYPE","");
            serviceData.putString("DD_BANK_ACCT_NO","");
            serviceData.putString("DD_BANK_NAME","");
            serviceData.putString("DD_BANK_ACCT_NAME","");
            serviceData.putString("DD_BANK_BRANCH","");
        }

        String spreader_num = "";
        String spreader_name = "";
        String spreader_bank_one = "";
        String spreader_bank_two = "";
        String spreader_bank_three = "";
        String spreader_bank_four = "";
        String channel_id = approLineInfo.getChannel_id();
        if ("FH".equals(channel_id)){
            spreader_num = approLineInfo.getSales_code();
            spreader_name = approLineInfo.getSalses_name();
            spreader_bank_one = serviceData.getString("first_sub_branch");
            spreader_bank_two = serviceData.getString("second_sub_branch");
            spreader_bank_three = serviceData.getString("third_sub_branch");
            spreader_bank_four = serviceData.getString("fourth_sub_branch");
        }
        serviceData.putString("APP_PROMOTION_CD","");
        serviceData.putString("IS_PRD_CHANGE","");
        serviceData.putString("IS_SALES_IND","");
        serviceData.putString("SPREADER_NUM",spreader_num);
        serviceData.putString("SPREADER_NAME",spreader_name);
        serviceData.putString("SPREADER_PHONE","");
        serviceData.putString("SPREADER_BANK_ONE",spreader_bank_one);
        serviceData.putString("SPREADER_BANK_TWO",spreader_bank_two);
        serviceData.putString("SPREADER_BANK_THREE",spreader_bank_three);
        serviceData.putString("SPREADER_BANK_FOUR",spreader_bank_four);
        serviceData.putString("SPREADER_TYPE","");

        String imRelation = approLineInfo.getImmidediate_relation();
        if ("1".equals(imRelation)){
            imRelation = "W";
        } else if ("2".equals(imRelation)){
            imRelation = "Y";
        } else if ("3".equals(imRelation)){
            imRelation = "T";
        } else if ("4".equals(imRelation)){
            imRelation = "C";
        } else if ("5".equals(imRelation)){
            imRelation = "D";
        } else if ("6".equals(imRelation)){
            imRelation = "H";
        } else if ("7".equals(imRelation)){
            imRelation = "L";
        } else if ("8".equals(imRelation)){
            imRelation = "O";
        }

        String otherRelation = approLineInfo.getOther_relation();
        if ("1".equals(otherRelation)){
            otherRelation = "Y";
        } else if ("2".equals(otherRelation)){
            otherRelation = "T";
        } else if ("3".equals(otherRelation)){
            otherRelation = "W";
        } else if ("4".equals(otherRelation)){
            otherRelation = "O";
        }
        serviceData.putString("SPREADER_WAY","");
        serviceData.putString("CONTACT_NAME",approLineInfo.getImmidediate_name());
        serviceData.putString("CONTACT_GENDER","");
        serviceData.putString("CONTACT_RELATION",imRelation);
        serviceData.putString("CONTACT_MOBILE",approLineInfo.getImmidediate_mobile());
        serviceData.putString("CONTACT_TELEPHONE","");
        serviceData.putString("CONTACT_EMP_PHONE","");
        serviceData.putString("CONTACT_ONAME",approLineInfo.getOther_name());
        serviceData.putString("CONTACT_OGENDER","");
        serviceData.putString("CONTACT_ORELATION",otherRelation);

        serviceData.putString("CONTACT_OMOBILE",approLineInfo.getOther_mobile());
        serviceData.putString("CONTACT_OTELEPHONE","");
        serviceData.putString("CONTACT_OEMP_PHONE","");
        String one_four_four = "";
        if (approLineInfo.getMonthly_mortgage_payment()!=null && !"".equals(approLineInfo.getMonthly_mortgage_payment())){
            one_four_four = String.valueOf(Integer.parseInt(approLineInfo.getMonthly_mortgage_payment())*100);

        }
        serviceData.putString("MONTHLY_REPAYMENT_AMT",one_four_four);
        serviceData.putString("RESIDENT_IDENTITY_TYPE","仅为中国税收居民");
        serviceData.putString("CAR_LPN",approLineInfo.getCar_number());
        serviceData.putString("CAR_BRAND",approLineInfo.getCar_brand());

        String auditResult = approLineInfo.getAudit_result();
        if ("P".equals(auditResult)){
            auditResult = "P";
        } else if ("D".equals(auditResult)){
            auditResult = "R";
        }
        serviceData.putString("PRE_CHECK_RESULT",auditResult);

        String one_four_nine = "";
        if (approLineInfo.getAmount()!=null && !"".equals(approLineInfo.getAmount())){
            one_four_nine = String.valueOf(Integer.parseInt(approLineInfo.getAmount())*100);
        }

        serviceData.putString("SUG_LMT",one_four_nine);
        serviceData.putString("REFUSE_CODE",approLineInfo.getRefuse_code());
    }

    @Test
    public void method1(){
        //serviceData.putString("sex",1);

    }
}
